package com.groovy.learning

import groovy.text.GStringTemplateEngine
import groovy.text.Template

String sourceRoot = 'src/com/groovy/learning';
String outputRoot = 'output/';
File dir = new File(sourceRoot);

for (f in dir.listFiles()) {
	
	if(f.isFile()) {
		
		File templateFile = new File('webSourceTemplate.html')
		
		GStringTemplateEngine engine = new GStringTemplateEngine()
		def binding = ["source":f.text]
		template = engine.createTemplate(templateFile).make(binding)
		File outputFile = new File(outputRoot+f.name.replace('groovy', 'html'))
		
		outputFile.write(template.toString())
		
		
		
	}
}
